#include "server.h"

Server::Server(IPortableSocket::SockType type, unsigned int port)
{
  this->_games = gamePool::getInstance();
  this->_network = new PortableNetworkManager();
  PortableSocket *s = new PortableSocket();
  s->createServerSocket(type, port);
  Player *pl = new Player(s);
  this->_network->addPlayer(pl);
}

Server::~Server()
{
}

gamePool *Server::getGames()
{
  return this->_games;
}

PortableNetworkManager *Server::getNetwork()
{
  return this->_network;
}

void Server::loop()
{
  while (1)
    {
      std::cout << "MODIFIER RUNGAME EN RUN" << std::endl;
      this->_network->runGame();
    }
}
